package org.gary.feedback.model;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 * 留言
 * @author lengreen
 *
 */
@Entity
public class Feedback implements lengreen.core.interfaces.Entity {
	/**
	 * 在记录日志中需要用到该方法
	 */
	@Override
	public String toString() {
		return "Feedback [createDate=" + createDate + ", 邮箱=" + email + ", id="
				+ id + ", 昵称=" + nickname + ", 电话号码=" + phone + ", 是否可见="
				+ visible + "]";
	}

	private int id;
	private boolean visible;
	private String nickname;// 昵称
	private String email;// 电子邮件
	private String phone;// 电话号码
	private String content;// 内容
	private String code;// 验证码

	@Transient
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	private Date createDate;

	public Feedback() {
		setCreateDate(new Date());
		setVisible(true);
	}

	@Id
	@GeneratedValue
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Lob
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Temporal(TemporalType.TIMESTAMP)
	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public void setVisible(boolean visible) {
		this.visible = visible;
	}

	public boolean isVisible() {
		return visible;
	}
}
